Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jul 18, 2025

Motivation:

The command plugin has a few rough edges which make it harder to use than it should.

Modifications:

  • Check if help was requested before doing any other arg parsing.
  • Print help if no arguments were passed at all.
  • Check all input files end in '.proto', if they don't it's likely an option was passed in the wrong place, so print a helpful error message.
  • Change the default output path to be ".", i.e. the directory of the caller. Previously it was the plugin working directory which is buried in '.build' so it would appear as if nothing was generated.
  • Improve the formatting of the error message if the protoc invocation failed. The error message now includes a better formatted command that the user can invoke directly. Remove the error description because it was always "NSTaskTermination" without any useful information attached.

Result:

Command plugin is a little easier to use.

Motivation:

The command plugin has a few rough edges which make it harder to use
than it should.

Modifications:

- Check if help was requested before doing any other arg parsing.
- Check all input files end in '.proto', if they don't it's likely an
  option was passed in the wrong place, so print a helpful error
  message.
- Change the default output path to be ".", i.e. the directory of the
  caller. Previously it was the plugin working directory which is buried
  in '.build' so it would appear as if nothing was generated.
- Improve the formatting of the error message if the protoc invocation
  failed. The error message now includes a better formatted command that
  the user can invoke directly. Remove the error description because it
  was always "NSTaskTermination" without any useful information
  attached.

Result:

Command plugin is a little easier to use.
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Jul 18, 2025
@glbrntt glbrntt requested a review from gjcairo July 18, 2025 09:52
@glbrntt glbrntt enabled auto-merge (squash) July 18, 2025 09:52
Copy link
Collaborator

@gjcairo gjcairo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

@glbrntt glbrntt merged commit 44a0230 into grpc:main Jul 18, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants